package org.example;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.apache.poi.util.StringUtil;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
public class AddressDataListener extends AnalysisEventListener<AddressData> {


  List<AddressAnzData> list;

  public AddressDataListener(List list) {
    this.list = list;
  }


  @Override
  public void invoke(AddressData data, AnalysisContext context) {
    log.info("----------" + data.address);
    System.out.println(data.address);
      if (!StringUtils.isEmpty(data.address)) {
        AddressAnzData address = new AddressAnzData();
        address.setAddress(data.address);
        list.add(address);
      }
  }

  @Override
  public void doAfterAllAnalysed(AnalysisContext context) {

  }

}
